package object3D;

import context.*;

import geometry3D.Point3D;

import model2D.Model2D;
import object2D.VinduProjection;

import java.awt.Color;

import javax.media.j3d.Group;
import javax.vecmath.Color3f;

import org.json.JSONException;

// ***************************************************************************
// *** CLASS: Vindu
// ***************************************************************************
public class Vindu extends Block implements Context.Constants
{ //private static final boolean DEBUG=true; // Overriding Context.Constants.DEBUG

  public int nRam;
  public boolean omramming;

  public Vindu(String ident,Point3D p0,int nRam,boolean omramming,double width,double height,double depth)
  { super(ident,p0,width,height,depth);//,tanTakVinkel,timber);
//    nRam=2; // XXX: !!!
    this.nRam=nRam;
//  omramming=false; // XXX: !!!!!
    if(height>1.0) omramming=true; // XXX: !!!!!
    this.omramming=omramming;
  }
    
  
  // ***************************************************************************
  // *** METHOD: getModel3D
  // ***************************************************************************
  public /*abstract*/ Group getModel3D(Color3f c)
  {
    //if(DEBUG) Debug.println("Vindu-->3D  p0="+p0+", width="+width+", height="+height+", depth="+depth);
    Group tg=new Group();
    addVinduModel(tg,c);
    return(tg);
  }  

  private void addVinduModel
//  (Graphics2D g,Rectangle2D.Double r0,Color c)
  (Group tg,Color3f c)
  { Color vindusRammeFarge=uthusFarge;
    c=new Color3f(vindusRammeFarge);

//    tg.addChild(super.getModel3D(c));  // TEST !!!!

  }

  // ***************************************************************************
  // *** METHOD: addProjection  (2D)
  // ***************************************************************************
  // 3D ==> 2D projections the XZ, XY or ZY-plane
  public void addProjection(Model2D objectModel,int type,int direction,Color color,float opacity)
  throws JSONException
  { objectModel.addChild(new VinduProjection(objectModel,this,type,direction,color,opacity)); }

}
